package com.ruoyi.common.core.utils;

//统一返回为结果集R   1为成功,0为失败
public class R<T>  {

  private Integer code; //编码：1成功，0和其它数字为失败
  private String message; //错误信息
  private T data; //数据

  //静态方法返回成功时候,R的属性
  public static <T> R<T> success(T object) {
      R<T> r = new R<>();
      r.data = object;
      r.code = 200;
      return r;
  }

  //静态方法返回失败时传入消息
  public static <T> R error(String message) {
      R r = new R();
      r.message = message;
      r.code = 500;
      return r;
  }
  // getter和setter方法省略...  

	public Integer getCode() {
		return code;
	}
	
	public void setCode(Integer code) {
		this.code = code;
	}
	
	public String getMessage() {
		return message;
	}
	
	public void setMsg(String message) {
		this.message = message;
	}
	
	public T getData() {
		return data;
	}
	
	public void setData(T data) {
		this.data = data;
	}
  
}
